<div class="main">
<!-- 弹出层主体内容 -->
<div class="open-box" style="padding:5px 5px 0 5px">
    <form id="open-form" action="admin/setting/update" method="POST" onsubmit="return false;">
        <div class="article-main d-flex">
            <div class="form-group">
                <label for="site_title">网站标题</label>
                <input autocomplete="off" id="site_title" name="site_title"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_subtitle">副标题</label>
                <input autocomplete="off" id="site_subtitle" name="site_subtitle"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_keywords">seo关键词</label>
                <input autocomplete="off" id="site_keywords" name="site_keywords"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_description">网站描述</label>
                <textarea autocomplete="off" id="site_description" name="site_description"  class="form-control form-control-lg" type="text">
                </textarea>
            </div>
            <div class="form-group">
                <label for="site_copyright">版权信息</label>
                <input autocomplete="off" id="site_copyright" name="site_copyright"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_icp">备案号</label>
                <input autocomplete="off" id="site_icp" name="site_icp"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_logo">网站logo</label>
                <input autocomplete="off" id="site_logo" name="site_logo"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_contact">联系人</label>
                <input autocomplete="off" id="site_contact" name="site_contact"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_phone">联系电话</label>
                <input autocomplete="off" id="site_phone" name="site_phone"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_address">联系地址</label>
                <input autocomplete="off" id="site_address" name="site_address"  class="form-control form-control-lg" type="text">
            </div>
            <div class="form-group">
                <label for="site_email">邮箱</label>
                <input autocomplete="off" id="site_email" name="site_email"  class="form-control form-control-lg" type="text">
            </div>

            <div class="form-group">
                <label for="site_useStatic" >开启伪静态</label>
                <div class="custom-control custom-switch" style="width:15%;display:inline-block;">
                    <input id="site_useStatic"  url='/admin/setting/enableStatic' type="checkbox" class="custom-control-input" >
                    <label class="custom-control-label" for="site_useStatic"></label>
                </div>
            </div>
            <div class="form-group">
                <label for="site_viewprefix" >伪静态后缀</label>
                <input autocomplete="off" id="site_viewprefix" name="site_viewprefix"  class="form-control form-control-md" type="text">
            </div>
            <div class="form-group text-center">
                <button id="submit-btn" class="btn btn-success btn-sm pl-2 pr-3">
                    <i class="fa fa-check mr-1"></i>更新
                </button>
            </div>
        </div>
    </form>
</div>
</div>
<style>
#open-form{
	width:100%;
}
.article-main {
	margin: 1px -7px;
	flex-wrap: wrap;
}
.article-main .form-group{
   width:80%;
}
.panel {
	flex: 1 1 auto;
	margin: 10px 8px 0;
}
.panel-body {
	padding: 10px;
	/* width: 550px; */
	flex-direction: column;
	width: 100%;	/* echarts 支持使用百分比 */
	min-height: 500px;
}
.panel-item{
	width:100%;
}
.panel-item-header{
    height: 40px;
    line-height: 40px;
	text-align:left;
	color: #333;
    font-size: 16px;
	border-bottom:1px solid #eee;
}
.panel-item-body {
	/* flex 元素多行时多行的对齐方式，默认值 stretch 占满整个交叉轴 */
	align-content: flex-start;
	flex-wrap: wrap;
	padding: 10px 0;
	min-height:60px;

}
.pic-view{
  margin-top:10px;
  display:block;
  width:100%;
  cursor:handler;
}
.panel-item-body div.fa-box {
    flex: 0 0 auto;
    width: 100%;
    margin: 5px 10px 10px 0px;
    padding: 10px 0;
}
.small-image .panel-item-body .fa-box {
    flex: 0 0 100%;
    margin: 10px 0 20px 0;
    height: 150px;
    background-color: #f8f9fa;
    border: #f0f0f0 1px solid;
    text-align: center;
}
.panel-item-body div.fa-box i {
	margin-top:25px;
	font-size: 40px;
	color: #555;
	margin-bottom: 0.8rem;
}
.panel-item-body div.fa-box i:hover {
		font-size: 36px;
		cursor: pointer;
}
.fa-box p {
	font-size: 15px;
}
.panel-item-info{
	text-align:left;
	color: #ddd;
    font-size: 14px;
    display:inline-block;
    padding:5px 0;
}
</style>
<script>
 $(function(){
    kit.get("/admin/setting/findAll",function(res){
        res.forEach((item,index,array)=>{
           if(item.setting_key =="site_useStatic"){
             var _static = item.value=="true"?true:false;
             $("#site_useStatic").prop("checked",_static);
           }else{
             $("#"+item.setting_key).val(item.value);
           }


        })
    });
    // 绑定提交按钮事件
	$("#submit-btn").on("click", submitSetting);
  })
  function submitSetting(){
	var arrs=[];
	$("#open-form").find(".form-control").each(function(index,ele){
		arrs.push({"settingKey":ele.name,"value":ele.value});
	});
	var list = JSON.stringify(arrs);
    $.ajax({
          type:'post',
          url:'/admin/setting/update',
          contentType :'application/json',
          data:list,
          success:function (ret) {
             kit.msg(ret);
         }
    })
  }
</script>